public class RobotTravelling {
  public int numWays ( int X, int Y ) {
    
    return doWays( 0, 0, X, Y );
  }  
  public int doWays( int x_now, int y_now, int X, int Y ) {
      if(x_now > X || y_now > Y) return 0;
      if(x_now == X && y_now == Y) return 1;
      
      return doWays( x_now+1, y_now, X, Y) + doWays( x_now, y_now+1, X, Y);
    }
}